using UnityEngine.UIElements;

namespace DA.AnimGraph.Editor {
    internal class InspectorField_BlendSpaceVertex : InspectorField<AGAFieldModel_BlendSpace2DVertex> {

        InspectorField_ClipLink clipField;
        Vector2Field positionField;

        protected override void BuildUI() {
            clipField = new InspectorField_ClipLink();
            clipField.Init("clip", source.clip, ageContext, OnChanged);

            positionField = new Vector2Field("position");
            positionField.value = source.position;
            positionField.RegisterValueChangedCallback(evt => OnChanged());
        }

        protected override void DrawUI() {
            Add(clipField);
            Add(positionField);
        }

        private void OnChanged() {
            source.position = positionField.value;

            inspectorChangeCallback?.Invoke();
        }
    }
}
